﻿@model IEnumerable<DataModel.ResourceZip>

@{
    ViewBag.Title = "Ziplist";
}

    <link href="@Url.Content("~/Scripts/uploadify-v3.1/uploadify.css")" rel="stylesheet" type="text/css" />
   <script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/uploadify-v3.1/jquery.uploadify-3.1.min.js")" type="text/javascript"></script>
<table class="upload-zip">
    <tr>
        <th style="width:15%;">
            资源标题
        </th>
        <th style="width:35%;">
           资源名称
        </th>

        <th colspan="2" style="width:50%;">操作</th>
    </tr>

@foreach (var item in Model) {
    <tr>
      <td>
            @Html.DisplayFor(modelItem => item.PackageFileTitle)
        </td>

        <td>
            @Html.DisplayFor(modelItem => item.PackageFileName)
        </td>
  
        <td>
       <div class="editor-field">
    <script type="text/javascript">
        var auth = "@(Request.Cookies[FormsAuthentication.FormsCookieName]==null ? string.Empty : Request.Cookies[FormsAuthentication.FormsCookieName].Value)";
        var ASPSESSID = "@Session.SessionID";
        $(function () {
            //    ziptitle = document.getElementById("ziptitle").value;
            $('#@item.ID').uploadify({
                'auto': false,
                'formData': { 'resourceid': '@ViewData["resourceid"]', 'resourcezipid': '@item.ID', 'state': 1, 'ASPSESSID': ASPSESSID, 'AUTHID': auth },
                'buttonText': '选择资源包文件',
                'swf': '@Url.Content("~/Scripts/uploadify-v3.1/uploadify.swf")',
                'uploader': '/Resource/uploadzip',

                @*               'uploader': '@Url.Content("~/Scripts/uploadify-v3.1/uploadify.swf")',
                'script': '@Url.Action("Videos", "UploadVideo")',*@

               @* 'buttonImage': '@Url.Content("~/Scripts/uploadify-v3.1/browse-btn.png")',*@
                'fileTypeDesc': '资源包',
                'method': 'post',
                'fileTypeExts': '*.zip;*ZIP',
                'fileSizeLimit': 0,
                'fileDataName': 'file',
                //   'uploadLimit': 1,
                'onUploadComplete': function (data) {
                    //  $('#showzip').html(file.name + ' 成功上传！');
                    window.location.href = "@Url.Action("ZipUploadFile")" + "?resourceid="+"@ViewData["resourceid"]";
                    
                }
                //'onUploadSuccess': function (file, data, response) {
                //    if (data['Success']=='1')   $("#tishi").html("该资源包不符合要求，请重新上传该zip包！");
                //    if (data['Success'] == '2')   $("#tishi").html("该资源包不符合要求，请重新上传该zip包！");

                //}
            });
        });
    </script>
           <div id="tishi"></div>
                <span style="color:red"> <input style="color:red" type="file" id='@item.ID' name="file_upload" /></span>
            <div id="showzip"></div>
        </div>
          @*  @Html.ActionLink("上传资源", "ZipEdit", new { id=item.ID }) |*@

        </td>
        <td>
           @* @Html.ActionLink("修改", "ZipEdit", new { id=item.ID }) |*@
            <a href="javascript:$('#@item.ID').uploadify('upload','*');">上传</a>
            <a href="javascript:$('#@item.ID').uploadify('cancel', '*');">取消</a>
            @Html.ActionLink("删除", "DeleteZipUpload", new { id = item.ID}, new { onclick="return confirm('确认删除？');"} )
        </td>
    </tr>
}

</table>
